import nx from '@nx/eslint-plugin';

export default [
  { ignores: ['**/dist', '**/node_modules'] },
  ...(nx.configs['flat/base'] || []),
  ...(nx.configs['flat/typescript'] || []),
  ...(nx.configs['flat/javascript'] || []),
  {
    files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
    plugins: { '@nx': nx },
    rules: {
      '@nx/enforce-module-boundaries': [
        'error',
        {
          enforceBuildableLibDependency: true,
          allow: ['^.*/eslint(\.base)?\.config\.[cm]?js$'],
          depConstraints: [
            {
              sourceTag: '*',
              onlyDependOnLibsWithTags: ['*'],
            },
          ],
        },
      ],
    },
  },
];